﻿using AspectCore.DynamicProxy;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using JESAI.Core.Aspects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Xml.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Reflection;
using JESAI.Framework.Mvc;

namespace JESAI.Framework.Attributes
{
    /// <summary>
    /// 审计日志特性
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class AuditLogAttribute : ActionFilterAttribute
    {

        public AuditLogAttribute()
        {

        }
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            var descriptor = context.ActionDescriptor as ControllerActionDescriptor;
            var actionName = descriptor?.ActionName;
            var controllerName = descriptor?.ControllerName;

           
        }

        public override void  OnResultExecuting(ResultExecutingContext context)
        {
            if (context.Result is ApiResult apiResult)
            {
                var descriptor = context.ActionDescriptor as ControllerActionDescriptor;
                var actionName = descriptor?.ActionName;
                var controllerName = descriptor?.ControllerName;            
            }
        }    
    }
}
